<template>
<el-form>
  <h1>登录</h1>
  <el-form-item label="用户名">
    <el-input v-model="account"></el-input>
  </el-form-item>
  <el-form-item label="密码">
    <el-input v-model="password"></el-input>
  </el-form-item>
<el-button type="primary" @click="submitlogin">登录</el-button>
</el-form>
</template>

<script>
export default {
  name: "Login",
  data(){
    return{
      account:"",
      password:""
    }
  },
  methods:{
    submitlogin(){
      let userlogin={
        account:this.account,
        password:this.password
      }
      let that=this
      this.$store.dispatch('login', userlogin).then(() => {
        console.log("登录")
        that.$router.push("/")
    })
  }
}}
</script>

<style scoped>

</style>
